<jsp:directive.page session="true" />
<%@ page import="org.biojava.services.das.dao.RegistryUser" %>
<%@ page import="org.biojava.services.das.registry.UserManager" %>
<jsp:directive.page import="org.biojava.services.das.dao.ProjectBean"/>
<jsp:useBean id="coord" class="dasregistry.coordBean" scope="page"/>
<jsp:directive.page import="org.springframework.beans.factory.BeanFactory"/>
<jsp:directive.page import="org.springframework.context.support.ClassPathXmlApplicationContext"/>
<%@ include file="sangerheader.jsp" %>
<% 
    
	if ( email == null) {		
		response.sendRedirect("login.jsp");	
		return;
	}
	
	
	
	

%>


<%
	String title = "create new Project";
	String header = title;
%>



<div id="main">
<%
String message = (String)request.getAttribute("message") ;
if (message != null) {
%>
<p><strong><%=message%></strong></p>
<%
}
%>


<h2>Currently known projects</h2>

<p>
Projects allow to give credits about the <strong>funding of a DAS source</strong>. 
Assigning a DAS source to a project means "This DAS source has been funded by project XXX".
</p>

<%@ include file="sangertablestart.jsp" %>
<tr id="row0">
<td>Name</td>
<td>Homepage</td>
<td>Description</td>
<td>Icon</td>
</tr>
<% 

	ProjectBean[] projects= coord.getAllProjects();
	for (int i=0; i<projects.length;i++){
		ProjectBean p = projects[i];
	%><tr>
	
	<td><%=p.getName() %></td>
	<td><a href="<%=p.getHomepage() %>"><%=p.getHomepage() %></a></td>
	<% RegistryUser owner = p.getOwner();
			
				%></td>
	<td><%=p.getDescription() %>
	<td><img src="ProjectIcon?id=<%=p.getProjectID()%>"/>
	</tr>
	<% 
	}
%>
<%@ include file ="sangertableend.jsp" %>


<h2>Create new Project</h2>
<p>
Please provide an icon for your project. This icon will be scaled to a height of 16 pixels and
can be used by DAS clients for display next to a DAS track.
</p>

<% int size=30; %>
<form action="FileUpload" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Name:</td>
<td><input type="text" size="<%=size %>" name="projectName" value="<%
if ( request.getAttribute("projectName") != null ) 
	out.print(request.getAttribute("projectName"));
%>"/></td>
</tr>

<tr>
<td>Homepage:</td>
<td><input type="text" size="<%=size %>" name="projectUrl" value="<%
	if ( request.getAttribute("projectUrl") != null ) 
		out.print(request.getAttribute("projectUrl"));

%>"/></td>
</tr>


<tr>
<td>Owner:</td>
<td><%= email %><input type="hidden" name="projectOwner" value="<%=email %>"/>
</td>
</tr>

<tr>
<td>Description:</td>
<td><textarea rows="5" cols="<%=size %>" name="projectDesc"><%
	if ( request.getAttribute("projectDesc") != null ) 
		out.print(request.getAttribute("projectDesc"));

%></textarea>
</tr>

<tr>
<td>Icon:</td>
<td> <input type="file" name="file" size="<%=size %>" value="<%
	if ( request.getAttribute("file") != null ) 
		out.print(request.getAttribute("file"));

%>"/>
</tr>

<tr>
<td></td>
<td><input type="submit" value="create new project"/></td>
</tr>

</table>
</form>

</div>

<%@ include file="sangerfooter.jsp"%>
